using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace CXDB
{
	/// <summary>
	/// Strongly-typed collection for the CxStaffSafty class.
	/// </summary>
    [Serializable]
	public partial class CxStaffSaftyCollection : ActiveList<CxStaffSafty, CxStaffSaftyCollection>
	{	   
		public CxStaffSaftyCollection() {}
        
        /// <summary>
		/// Filters an existing collection based on the set criteria. This is an in-memory filter
		/// Thanks to developingchris for this!
        /// </summary>
        /// <returns>CxStaffSaftyCollection</returns>
		public CxStaffSaftyCollection Filter()
        {
            for (int i = this.Count - 1; i > -1; i--)
            {
                CxStaffSafty o = this[i];
                foreach (SubSonic.Where w in this.wheres)
                {
                    bool remove = false;
                    System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
                    if (pi.CanRead)
                    {
                        object val = pi.GetValue(o, null);
                        switch (w.Comparison)
                        {
                            case SubSonic.Comparison.Equals:
                                if (!val.Equals(w.ParameterValue))
                                {
                                    remove = true;
                                }
                                break;
                        }
                    }
                    if (remove)
                    {
                        this.Remove(o);
                        break;
                    }
                }
            }
            return this;
        }
		
		
	}
	/// <summary>
	/// This is an ActiveRecord class which wraps the CX_Staff_Safty table.
	/// </summary>
	[Serializable]
	public partial class CxStaffSafty : ActiveRecord<CxStaffSafty>, IActiveRecord
	{
		#region .ctors and Default Settings
		
		public CxStaffSafty()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}
		
		private void InitSetDefaults() { SetDefaults(); }
		
		public CxStaffSafty(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}
        
		public CxStaffSafty(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}
		 
		public CxStaffSafty(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}
		
		protected static void SetSQLProps() { GetTableSchema(); }
		
		#endregion
		
		#region Schema and Query Accessor	
		public static Query CreateQuery() { return new Query(Schema); }
		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}
		}
		
		private static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("CX_Staff_Safty", TableType.Table, DataService.GetInstance("CXDB"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarId = new TableSchema.TableColumn(schema);
				colvarId.ColumnName = "ID";
				colvarId.DataType = DbType.Int32;
				colvarId.MaxLength = 0;
				colvarId.AutoIncrement = true;
				colvarId.IsNullable = false;
				colvarId.IsPrimaryKey = true;
				colvarId.IsForeignKey = false;
				colvarId.IsReadOnly = false;
				colvarId.DefaultSetting = @"";
				colvarId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarId);
				
				TableSchema.TableColumn colvarUserID = new TableSchema.TableColumn(schema);
				colvarUserID.ColumnName = "userID";
				colvarUserID.DataType = DbType.Int32;
				colvarUserID.MaxLength = 0;
				colvarUserID.AutoIncrement = false;
				colvarUserID.IsNullable = true;
				colvarUserID.IsPrimaryKey = false;
				colvarUserID.IsForeignKey = false;
				colvarUserID.IsReadOnly = false;
				colvarUserID.DefaultSetting = @"";
				colvarUserID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUserID);
				
				TableSchema.TableColumn colvarDeptID = new TableSchema.TableColumn(schema);
				colvarDeptID.ColumnName = "DeptID";
				colvarDeptID.DataType = DbType.Int32;
				colvarDeptID.MaxLength = 0;
				colvarDeptID.AutoIncrement = false;
				colvarDeptID.IsNullable = true;
				colvarDeptID.IsPrimaryKey = false;
				colvarDeptID.IsForeignKey = false;
				colvarDeptID.IsReadOnly = false;
				colvarDeptID.DefaultSetting = @"";
				colvarDeptID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDeptID);
				
				TableSchema.TableColumn colvarAccidentTime = new TableSchema.TableColumn(schema);
				colvarAccidentTime.ColumnName = "Accident_time";
				colvarAccidentTime.DataType = DbType.DateTime;
				colvarAccidentTime.MaxLength = 0;
				colvarAccidentTime.AutoIncrement = false;
				colvarAccidentTime.IsNullable = true;
				colvarAccidentTime.IsPrimaryKey = false;
				colvarAccidentTime.IsForeignKey = false;
				colvarAccidentTime.IsReadOnly = false;
				colvarAccidentTime.DefaultSetting = @"";
				colvarAccidentTime.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAccidentTime);
				
				TableSchema.TableColumn colvarAccidentDuty = new TableSchema.TableColumn(schema);
				colvarAccidentDuty.ColumnName = "Accident_Duty";
				colvarAccidentDuty.DataType = DbType.String;
				colvarAccidentDuty.MaxLength = 100;
				colvarAccidentDuty.AutoIncrement = false;
				colvarAccidentDuty.IsNullable = true;
				colvarAccidentDuty.IsPrimaryKey = false;
				colvarAccidentDuty.IsForeignKey = false;
				colvarAccidentDuty.IsReadOnly = false;
				colvarAccidentDuty.DefaultSetting = @"";
				colvarAccidentDuty.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAccidentDuty);
				
				TableSchema.TableColumn colvarAccidentReason = new TableSchema.TableColumn(schema);
				colvarAccidentReason.ColumnName = "Accident_reason";
				colvarAccidentReason.DataType = DbType.String;
				colvarAccidentReason.MaxLength = 1073741823;
				colvarAccidentReason.AutoIncrement = false;
				colvarAccidentReason.IsNullable = true;
				colvarAccidentReason.IsPrimaryKey = false;
				colvarAccidentReason.IsForeignKey = false;
				colvarAccidentReason.IsReadOnly = false;
				colvarAccidentReason.DefaultSetting = @"";
				colvarAccidentReason.ForeignKeyTableName = "";
				schema.Columns.Add(colvarAccidentReason);
				
				TableSchema.TableColumn colvarSaftyMasterID = new TableSchema.TableColumn(schema);
				colvarSaftyMasterID.ColumnName = "Safty_MasterID";
				colvarSaftyMasterID.DataType = DbType.Int32;
				colvarSaftyMasterID.MaxLength = 0;
				colvarSaftyMasterID.AutoIncrement = false;
				colvarSaftyMasterID.IsNullable = true;
				colvarSaftyMasterID.IsPrimaryKey = false;
				colvarSaftyMasterID.IsForeignKey = false;
				colvarSaftyMasterID.IsReadOnly = false;
				colvarSaftyMasterID.DefaultSetting = @"";
				colvarSaftyMasterID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSaftyMasterID);
				
				TableSchema.TableColumn colvarSaftyMasterTime = new TableSchema.TableColumn(schema);
				colvarSaftyMasterTime.ColumnName = "Safty_Master_time";
				colvarSaftyMasterTime.DataType = DbType.DateTime;
				colvarSaftyMasterTime.MaxLength = 0;
				colvarSaftyMasterTime.AutoIncrement = false;
				colvarSaftyMasterTime.IsNullable = true;
				colvarSaftyMasterTime.IsPrimaryKey = false;
				colvarSaftyMasterTime.IsForeignKey = false;
				colvarSaftyMasterTime.IsReadOnly = false;
				colvarSaftyMasterTime.DefaultSetting = @"";
				colvarSaftyMasterTime.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSaftyMasterTime);
				
				TableSchema.TableColumn colvarSaftyMasterStatus = new TableSchema.TableColumn(schema);
				colvarSaftyMasterStatus.ColumnName = "Safty_Master_Status";
				colvarSaftyMasterStatus.DataType = DbType.Int32;
				colvarSaftyMasterStatus.MaxLength = 0;
				colvarSaftyMasterStatus.AutoIncrement = false;
				colvarSaftyMasterStatus.IsNullable = true;
				colvarSaftyMasterStatus.IsPrimaryKey = false;
				colvarSaftyMasterStatus.IsForeignKey = false;
				colvarSaftyMasterStatus.IsReadOnly = false;
				colvarSaftyMasterStatus.DefaultSetting = @"";
				colvarSaftyMasterStatus.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSaftyMasterStatus);
				
				TableSchema.TableColumn colvarSaftyMasterRemark = new TableSchema.TableColumn(schema);
				colvarSaftyMasterRemark.ColumnName = "Safty_Master_Remark";
				colvarSaftyMasterRemark.DataType = DbType.String;
				colvarSaftyMasterRemark.MaxLength = 1073741823;
				colvarSaftyMasterRemark.AutoIncrement = false;
				colvarSaftyMasterRemark.IsNullable = true;
				colvarSaftyMasterRemark.IsPrimaryKey = false;
				colvarSaftyMasterRemark.IsForeignKey = false;
				colvarSaftyMasterRemark.IsReadOnly = false;
				colvarSaftyMasterRemark.DefaultSetting = @"";
				colvarSaftyMasterRemark.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSaftyMasterRemark);
				
				TableSchema.TableColumn colvarDeptMasterId = new TableSchema.TableColumn(schema);
				colvarDeptMasterId.ColumnName = "Dept_Master_ID";
				colvarDeptMasterId.DataType = DbType.Int32;
				colvarDeptMasterId.MaxLength = 0;
				colvarDeptMasterId.AutoIncrement = false;
				colvarDeptMasterId.IsNullable = true;
				colvarDeptMasterId.IsPrimaryKey = false;
				colvarDeptMasterId.IsForeignKey = false;
				colvarDeptMasterId.IsReadOnly = false;
				colvarDeptMasterId.DefaultSetting = @"";
				colvarDeptMasterId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDeptMasterId);
				
				TableSchema.TableColumn colvarDeptMasterRemark = new TableSchema.TableColumn(schema);
				colvarDeptMasterRemark.ColumnName = "Dept_Master_Remark";
				colvarDeptMasterRemark.DataType = DbType.String;
				colvarDeptMasterRemark.MaxLength = 1073741823;
				colvarDeptMasterRemark.AutoIncrement = false;
				colvarDeptMasterRemark.IsNullable = true;
				colvarDeptMasterRemark.IsPrimaryKey = false;
				colvarDeptMasterRemark.IsForeignKey = false;
				colvarDeptMasterRemark.IsReadOnly = false;
				colvarDeptMasterRemark.DefaultSetting = @"";
				colvarDeptMasterRemark.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDeptMasterRemark);
				
				TableSchema.TableColumn colvarDeptMasterStatus = new TableSchema.TableColumn(schema);
				colvarDeptMasterStatus.ColumnName = "Dept_Master_Status";
				colvarDeptMasterStatus.DataType = DbType.Int32;
				colvarDeptMasterStatus.MaxLength = 0;
				colvarDeptMasterStatus.AutoIncrement = false;
				colvarDeptMasterStatus.IsNullable = true;
				colvarDeptMasterStatus.IsPrimaryKey = false;
				colvarDeptMasterStatus.IsForeignKey = false;
				colvarDeptMasterStatus.IsReadOnly = false;
				colvarDeptMasterStatus.DefaultSetting = @"";
				colvarDeptMasterStatus.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDeptMasterStatus);
				
				TableSchema.TableColumn colvarDeptMasterTime = new TableSchema.TableColumn(schema);
				colvarDeptMasterTime.ColumnName = "Dept_Master_time";
				colvarDeptMasterTime.DataType = DbType.DateTime;
				colvarDeptMasterTime.MaxLength = 0;
				colvarDeptMasterTime.AutoIncrement = false;
				colvarDeptMasterTime.IsNullable = true;
				colvarDeptMasterTime.IsPrimaryKey = false;
				colvarDeptMasterTime.IsForeignKey = false;
				colvarDeptMasterTime.IsReadOnly = false;
				colvarDeptMasterTime.DefaultSetting = @"";
				colvarDeptMasterTime.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDeptMasterTime);
				
				TableSchema.TableColumn colvarBossUserID = new TableSchema.TableColumn(schema);
				colvarBossUserID.ColumnName = "Boss_UserID";
				colvarBossUserID.DataType = DbType.Int32;
				colvarBossUserID.MaxLength = 0;
				colvarBossUserID.AutoIncrement = false;
				colvarBossUserID.IsNullable = true;
				colvarBossUserID.IsPrimaryKey = false;
				colvarBossUserID.IsForeignKey = false;
				colvarBossUserID.IsReadOnly = false;
				colvarBossUserID.DefaultSetting = @"";
				colvarBossUserID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarBossUserID);
				
				TableSchema.TableColumn colvarBossTime = new TableSchema.TableColumn(schema);
				colvarBossTime.ColumnName = "Boss_time";
				colvarBossTime.DataType = DbType.DateTime;
				colvarBossTime.MaxLength = 0;
				colvarBossTime.AutoIncrement = false;
				colvarBossTime.IsNullable = true;
				colvarBossTime.IsPrimaryKey = false;
				colvarBossTime.IsForeignKey = false;
				colvarBossTime.IsReadOnly = false;
				colvarBossTime.DefaultSetting = @"";
				colvarBossTime.ForeignKeyTableName = "";
				schema.Columns.Add(colvarBossTime);
				
				TableSchema.TableColumn colvarBossRemark = new TableSchema.TableColumn(schema);
				colvarBossRemark.ColumnName = "Boss_Remark";
				colvarBossRemark.DataType = DbType.String;
				colvarBossRemark.MaxLength = 1073741823;
				colvarBossRemark.AutoIncrement = false;
				colvarBossRemark.IsNullable = true;
				colvarBossRemark.IsPrimaryKey = false;
				colvarBossRemark.IsForeignKey = false;
				colvarBossRemark.IsReadOnly = false;
				colvarBossRemark.DefaultSetting = @"";
				colvarBossRemark.ForeignKeyTableName = "";
				schema.Columns.Add(colvarBossRemark);
				
				TableSchema.TableColumn colvarBossStatus = new TableSchema.TableColumn(schema);
				colvarBossStatus.ColumnName = "Boss_Status";
				colvarBossStatus.DataType = DbType.Int32;
				colvarBossStatus.MaxLength = 0;
				colvarBossStatus.AutoIncrement = false;
				colvarBossStatus.IsNullable = true;
				colvarBossStatus.IsPrimaryKey = false;
				colvarBossStatus.IsForeignKey = false;
				colvarBossStatus.IsReadOnly = false;
				colvarBossStatus.DefaultSetting = @"";
				colvarBossStatus.ForeignKeyTableName = "";
				schema.Columns.Add(colvarBossStatus);
				
				TableSchema.TableColumn colvarEnteringUserID = new TableSchema.TableColumn(schema);
				colvarEnteringUserID.ColumnName = "EnteringUserID";
				colvarEnteringUserID.DataType = DbType.Int32;
				colvarEnteringUserID.MaxLength = 0;
				colvarEnteringUserID.AutoIncrement = false;
				colvarEnteringUserID.IsNullable = true;
				colvarEnteringUserID.IsPrimaryKey = false;
				colvarEnteringUserID.IsForeignKey = false;
				colvarEnteringUserID.IsReadOnly = false;
				colvarEnteringUserID.DefaultSetting = @"";
				colvarEnteringUserID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEnteringUserID);
				
				TableSchema.TableColumn colvarInTime = new TableSchema.TableColumn(schema);
				colvarInTime.ColumnName = "inTime";
				colvarInTime.DataType = DbType.DateTime;
				colvarInTime.MaxLength = 0;
				colvarInTime.AutoIncrement = false;
				colvarInTime.IsNullable = true;
				colvarInTime.IsPrimaryKey = false;
				colvarInTime.IsForeignKey = false;
				colvarInTime.IsReadOnly = false;
				
						colvarInTime.DefaultSetting = @"(getdate())";
				colvarInTime.ForeignKeyTableName = "";
				schema.Columns.Add(colvarInTime);
				
				TableSchema.TableColumn colvarStatus = new TableSchema.TableColumn(schema);
				colvarStatus.ColumnName = "Status";
				colvarStatus.DataType = DbType.Int32;
				colvarStatus.MaxLength = 0;
				colvarStatus.AutoIncrement = false;
				colvarStatus.IsNullable = true;
				colvarStatus.IsPrimaryKey = false;
				colvarStatus.IsForeignKey = false;
				colvarStatus.IsReadOnly = false;
				colvarStatus.DefaultSetting = @"";
				colvarStatus.ForeignKeyTableName = "";
				schema.Columns.Add(colvarStatus);
				
				TableSchema.TableColumn colvarGuid = new TableSchema.TableColumn(schema);
				colvarGuid.ColumnName = "Guid";
				colvarGuid.DataType = DbType.Guid;
				colvarGuid.MaxLength = 0;
				colvarGuid.AutoIncrement = false;
				colvarGuid.IsNullable = true;
				colvarGuid.IsPrimaryKey = false;
				colvarGuid.IsForeignKey = false;
				colvarGuid.IsReadOnly = false;
				colvarGuid.DefaultSetting = @"";
				colvarGuid.ForeignKeyTableName = "";
				schema.Columns.Add(colvarGuid);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["CXDB"].AddSchema("CX_Staff_Safty",schema);
			}
		}
		#endregion
		
		#region Props
		  
		[XmlAttribute("Id")]
		[Bindable(true)]
		public int Id 
		{
			get { return GetColumnValue<int>(Columns.Id); }
			set { SetColumnValue(Columns.Id, value); }
		}
		  
		[XmlAttribute("UserID")]
		[Bindable(true)]
		public int? UserID 
		{
			get { return GetColumnValue<int?>(Columns.UserID); }
			set { SetColumnValue(Columns.UserID, value); }
		}
		  
		[XmlAttribute("DeptID")]
		[Bindable(true)]
		public int? DeptID 
		{
			get { return GetColumnValue<int?>(Columns.DeptID); }
			set { SetColumnValue(Columns.DeptID, value); }
		}
		  
		[XmlAttribute("AccidentTime")]
		[Bindable(true)]
		public DateTime? AccidentTime 
		{
			get { return GetColumnValue<DateTime?>(Columns.AccidentTime); }
			set { SetColumnValue(Columns.AccidentTime, value); }
		}
		  
		[XmlAttribute("AccidentDuty")]
		[Bindable(true)]
		public string AccidentDuty 
		{
			get { return GetColumnValue<string>(Columns.AccidentDuty); }
			set { SetColumnValue(Columns.AccidentDuty, value); }
		}
		  
		[XmlAttribute("AccidentReason")]
		[Bindable(true)]
		public string AccidentReason 
		{
			get { return GetColumnValue<string>(Columns.AccidentReason); }
			set { SetColumnValue(Columns.AccidentReason, value); }
		}
		  
		[XmlAttribute("SaftyMasterID")]
		[Bindable(true)]
		public int? SaftyMasterID 
		{
			get { return GetColumnValue<int?>(Columns.SaftyMasterID); }
			set { SetColumnValue(Columns.SaftyMasterID, value); }
		}
		  
		[XmlAttribute("SaftyMasterTime")]
		[Bindable(true)]
		public DateTime? SaftyMasterTime 
		{
			get { return GetColumnValue<DateTime?>(Columns.SaftyMasterTime); }
			set { SetColumnValue(Columns.SaftyMasterTime, value); }
		}
		  
		[XmlAttribute("SaftyMasterStatus")]
		[Bindable(true)]
		public int? SaftyMasterStatus 
		{
			get { return GetColumnValue<int?>(Columns.SaftyMasterStatus); }
			set { SetColumnValue(Columns.SaftyMasterStatus, value); }
		}
		  
		[XmlAttribute("SaftyMasterRemark")]
		[Bindable(true)]
		public string SaftyMasterRemark 
		{
			get { return GetColumnValue<string>(Columns.SaftyMasterRemark); }
			set { SetColumnValue(Columns.SaftyMasterRemark, value); }
		}
		  
		[XmlAttribute("DeptMasterId")]
		[Bindable(true)]
		public int? DeptMasterId 
		{
			get { return GetColumnValue<int?>(Columns.DeptMasterId); }
			set { SetColumnValue(Columns.DeptMasterId, value); }
		}
		  
		[XmlAttribute("DeptMasterRemark")]
		[Bindable(true)]
		public string DeptMasterRemark 
		{
			get { return GetColumnValue<string>(Columns.DeptMasterRemark); }
			set { SetColumnValue(Columns.DeptMasterRemark, value); }
		}
		  
		[XmlAttribute("DeptMasterStatus")]
		[Bindable(true)]
		public int? DeptMasterStatus 
		{
			get { return GetColumnValue<int?>(Columns.DeptMasterStatus); }
			set { SetColumnValue(Columns.DeptMasterStatus, value); }
		}
		  
		[XmlAttribute("DeptMasterTime")]
		[Bindable(true)]
		public DateTime? DeptMasterTime 
		{
			get { return GetColumnValue<DateTime?>(Columns.DeptMasterTime); }
			set { SetColumnValue(Columns.DeptMasterTime, value); }
		}
		  
		[XmlAttribute("BossUserID")]
		[Bindable(true)]
		public int? BossUserID 
		{
			get { return GetColumnValue<int?>(Columns.BossUserID); }
			set { SetColumnValue(Columns.BossUserID, value); }
		}
		  
		[XmlAttribute("BossTime")]
		[Bindable(true)]
		public DateTime? BossTime 
		{
			get { return GetColumnValue<DateTime?>(Columns.BossTime); }
			set { SetColumnValue(Columns.BossTime, value); }
		}
		  
		[XmlAttribute("BossRemark")]
		[Bindable(true)]
		public string BossRemark 
		{
			get { return GetColumnValue<string>(Columns.BossRemark); }
			set { SetColumnValue(Columns.BossRemark, value); }
		}
		  
		[XmlAttribute("BossStatus")]
		[Bindable(true)]
		public int? BossStatus 
		{
			get { return GetColumnValue<int?>(Columns.BossStatus); }
			set { SetColumnValue(Columns.BossStatus, value); }
		}
		  
		[XmlAttribute("EnteringUserID")]
		[Bindable(true)]
		public int? EnteringUserID 
		{
			get { return GetColumnValue<int?>(Columns.EnteringUserID); }
			set { SetColumnValue(Columns.EnteringUserID, value); }
		}
		  
		[XmlAttribute("InTime")]
		[Bindable(true)]
		public DateTime? InTime 
		{
			get { return GetColumnValue<DateTime?>(Columns.InTime); }
			set { SetColumnValue(Columns.InTime, value); }
		}
		  
		[XmlAttribute("Status")]
		[Bindable(true)]
		public int? Status 
		{
			get { return GetColumnValue<int?>(Columns.Status); }
			set { SetColumnValue(Columns.Status, value); }
		}
		  
		[XmlAttribute("Guid")]
		[Bindable(true)]
		public Guid? Guid 
		{
			get { return GetColumnValue<Guid?>(Columns.Guid); }
			set { SetColumnValue(Columns.Guid, value); }
		}
		
		#endregion
		
		
			
		
		//no foreign key tables defined (0)
		
		
		
		//no ManyToMany tables defined (0)
		
        
        
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(int? varUserID,int? varDeptID,DateTime? varAccidentTime,string varAccidentDuty,string varAccidentReason,int? varSaftyMasterID,DateTime? varSaftyMasterTime,int? varSaftyMasterStatus,string varSaftyMasterRemark,int? varDeptMasterId,string varDeptMasterRemark,int? varDeptMasterStatus,DateTime? varDeptMasterTime,int? varBossUserID,DateTime? varBossTime,string varBossRemark,int? varBossStatus,int? varEnteringUserID,DateTime? varInTime,int? varStatus,Guid? varGuid)
		{
			CxStaffSafty item = new CxStaffSafty();
			
			item.UserID = varUserID;
			
			item.DeptID = varDeptID;
			
			item.AccidentTime = varAccidentTime;
			
			item.AccidentDuty = varAccidentDuty;
			
			item.AccidentReason = varAccidentReason;
			
			item.SaftyMasterID = varSaftyMasterID;
			
			item.SaftyMasterTime = varSaftyMasterTime;
			
			item.SaftyMasterStatus = varSaftyMasterStatus;
			
			item.SaftyMasterRemark = varSaftyMasterRemark;
			
			item.DeptMasterId = varDeptMasterId;
			
			item.DeptMasterRemark = varDeptMasterRemark;
			
			item.DeptMasterStatus = varDeptMasterStatus;
			
			item.DeptMasterTime = varDeptMasterTime;
			
			item.BossUserID = varBossUserID;
			
			item.BossTime = varBossTime;
			
			item.BossRemark = varBossRemark;
			
			item.BossStatus = varBossStatus;
			
			item.EnteringUserID = varEnteringUserID;
			
			item.InTime = varInTime;
			
			item.Status = varStatus;
			
			item.Guid = varGuid;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(int varId,int? varUserID,int? varDeptID,DateTime? varAccidentTime,string varAccidentDuty,string varAccidentReason,int? varSaftyMasterID,DateTime? varSaftyMasterTime,int? varSaftyMasterStatus,string varSaftyMasterRemark,int? varDeptMasterId,string varDeptMasterRemark,int? varDeptMasterStatus,DateTime? varDeptMasterTime,int? varBossUserID,DateTime? varBossTime,string varBossRemark,int? varBossStatus,int? varEnteringUserID,DateTime? varInTime,int? varStatus,Guid? varGuid)
		{
			CxStaffSafty item = new CxStaffSafty();
			
				item.Id = varId;
			
				item.UserID = varUserID;
			
				item.DeptID = varDeptID;
			
				item.AccidentTime = varAccidentTime;
			
				item.AccidentDuty = varAccidentDuty;
			
				item.AccidentReason = varAccidentReason;
			
				item.SaftyMasterID = varSaftyMasterID;
			
				item.SaftyMasterTime = varSaftyMasterTime;
			
				item.SaftyMasterStatus = varSaftyMasterStatus;
			
				item.SaftyMasterRemark = varSaftyMasterRemark;
			
				item.DeptMasterId = varDeptMasterId;
			
				item.DeptMasterRemark = varDeptMasterRemark;
			
				item.DeptMasterStatus = varDeptMasterStatus;
			
				item.DeptMasterTime = varDeptMasterTime;
			
				item.BossUserID = varBossUserID;
			
				item.BossTime = varBossTime;
			
				item.BossRemark = varBossRemark;
			
				item.BossStatus = varBossStatus;
			
				item.EnteringUserID = varEnteringUserID;
			
				item.InTime = varInTime;
			
				item.Status = varStatus;
			
				item.Guid = varGuid;
			
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		#endregion
        
        
        
        #region Typed Columns
        
        
        public static TableSchema.TableColumn IdColumn
        {
            get { return Schema.Columns[0]; }
        }
        
        
        
        public static TableSchema.TableColumn UserIDColumn
        {
            get { return Schema.Columns[1]; }
        }
        
        
        
        public static TableSchema.TableColumn DeptIDColumn
        {
            get { return Schema.Columns[2]; }
        }
        
        
        
        public static TableSchema.TableColumn AccidentTimeColumn
        {
            get { return Schema.Columns[3]; }
        }
        
        
        
        public static TableSchema.TableColumn AccidentDutyColumn
        {
            get { return Schema.Columns[4]; }
        }
        
        
        
        public static TableSchema.TableColumn AccidentReasonColumn
        {
            get { return Schema.Columns[5]; }
        }
        
        
        
        public static TableSchema.TableColumn SaftyMasterIDColumn
        {
            get { return Schema.Columns[6]; }
        }
        
        
        
        public static TableSchema.TableColumn SaftyMasterTimeColumn
        {
            get { return Schema.Columns[7]; }
        }
        
        
        
        public static TableSchema.TableColumn SaftyMasterStatusColumn
        {
            get { return Schema.Columns[8]; }
        }
        
        
        
        public static TableSchema.TableColumn SaftyMasterRemarkColumn
        {
            get { return Schema.Columns[9]; }
        }
        
        
        
        public static TableSchema.TableColumn DeptMasterIdColumn
        {
            get { return Schema.Columns[10]; }
        }
        
        
        
        public static TableSchema.TableColumn DeptMasterRemarkColumn
        {
            get { return Schema.Columns[11]; }
        }
        
        
        
        public static TableSchema.TableColumn DeptMasterStatusColumn
        {
            get { return Schema.Columns[12]; }
        }
        
        
        
        public static TableSchema.TableColumn DeptMasterTimeColumn
        {
            get { return Schema.Columns[13]; }
        }
        
        
        
        public static TableSchema.TableColumn BossUserIDColumn
        {
            get { return Schema.Columns[14]; }
        }
        
        
        
        public static TableSchema.TableColumn BossTimeColumn
        {
            get { return Schema.Columns[15]; }
        }
        
        
        
        public static TableSchema.TableColumn BossRemarkColumn
        {
            get { return Schema.Columns[16]; }
        }
        
        
        
        public static TableSchema.TableColumn BossStatusColumn
        {
            get { return Schema.Columns[17]; }
        }
        
        
        
        public static TableSchema.TableColumn EnteringUserIDColumn
        {
            get { return Schema.Columns[18]; }
        }
        
        
        
        public static TableSchema.TableColumn InTimeColumn
        {
            get { return Schema.Columns[19]; }
        }
        
        
        
        public static TableSchema.TableColumn StatusColumn
        {
            get { return Schema.Columns[20]; }
        }
        
        
        
        public static TableSchema.TableColumn GuidColumn
        {
            get { return Schema.Columns[21]; }
        }
        
        
        
        #endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string Id = @"ID";
			 public static string UserID = @"userID";
			 public static string DeptID = @"DeptID";
			 public static string AccidentTime = @"Accident_time";
			 public static string AccidentDuty = @"Accident_Duty";
			 public static string AccidentReason = @"Accident_reason";
			 public static string SaftyMasterID = @"Safty_MasterID";
			 public static string SaftyMasterTime = @"Safty_Master_time";
			 public static string SaftyMasterStatus = @"Safty_Master_Status";
			 public static string SaftyMasterRemark = @"Safty_Master_Remark";
			 public static string DeptMasterId = @"Dept_Master_ID";
			 public static string DeptMasterRemark = @"Dept_Master_Remark";
			 public static string DeptMasterStatus = @"Dept_Master_Status";
			 public static string DeptMasterTime = @"Dept_Master_time";
			 public static string BossUserID = @"Boss_UserID";
			 public static string BossTime = @"Boss_time";
			 public static string BossRemark = @"Boss_Remark";
			 public static string BossStatus = @"Boss_Status";
			 public static string EnteringUserID = @"EnteringUserID";
			 public static string InTime = @"inTime";
			 public static string Status = @"Status";
			 public static string Guid = @"Guid";
						
		}
		#endregion
		
		#region Update PK Collections
		
        #endregion
    
        #region Deep Save
		
        #endregion
	}
}
